package final_wearebatman_view;

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.TextArea;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;

public class HelpWindow extends Frame {

    private String msg;
    private Image img;

    // Help Window a program használatához
    public HelpWindow() {
        super("Help");
        setResizable(false);
        setLocationByPlatform(true);
        this.msg = "Open - You can browse for an existing test file in .txt format.\n"
                + "Start - Starts the simulation, automatic ticks.\n"
                + "Stop - Stops the simulation.\n"
                + "Tick - Ticks the circuit by one step.\n"
                + "Help - Opens this help.\n\n"
                + "Switch:\n"
                + "During the simulation, you can click on the switch to enable/disable it.\n\n"
                + "Generator:\n"
                + "If you click on the generator, you can edit the string of bits in the pop-up window.\n\n"
                + "About editing the test files, please read the attached documents.\n"
                + "Copyright © Wearebatman, 2011";
        MyTA t = new MyTA(this.msg);
        setLayout(new GridLayout());
        t.setEditable(false);
        img = new ImageIcon("img\\wab.jpg").getImage();
        img = img.getScaledInstance((int) (128 * 1.5), (int) (192 * 1.5), 0);
        add(t);
        setSize(657, 320);
        show();
        addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                e.getWindow().dispose();
            }
        });
    }

    class MyTA extends TextArea {

        public MyTA(String msg) {
            super(msg, 15, 70, TextArea.SCROLLBARS_NONE);
        }

        @Override
        public void paint(Graphics g) {
            g.drawImage(img, 450, 3, this);
            super.paintAll(g);
        }
    }
}
